home *** CD-ROM | disk | FTP | other *** search
- /* ================
- * AEAAppleEvent.cc
- * ================
- */
-
- #include "AEADebugging.h"
-
- #include <string.h>
-
- #include <AppleEvents.h>
-
- #include "AEAAppleEvent.hh"
-
- NGLList<AEAAppleEvent *> AEAAppleEvent::sWaitingEvents;
-
- AEAAppleEvent::AEAAppleEvent(const AppleEvent &inAppleEvent)
- : mAppleEvent(gNullDesc), mReply(gNullDesc), mSent(false)
- {
- OSErr err;
-
- err = ::AEDuplicateDesc(&inAppleEvent, &mAppleEvent);
- ThrowIfOSErr_(err);
-
- sWaitingEvents.Append(this);
- }
-
- AEAAppleEvent::~AEAAppleEvent()
- {
- OSErr err;
-
- sWaitingEvents.Remove(this);
-
- err = ::AEDisposeDesc(&mAppleEvent);
- err = ::AEDisposeDesc(&mReply);
- ThrowIfOSErr_(err);
- }
-
- void
- AEAAppleEvent::Send(AESendMode inReplyMode, AEIdleUPP &inAEIdleUPP)
- {
- OSErr err;
-
- err = ::AESend(&mAppleEvent, &mReply, inReplyMode | kAECanInteract, kAENormalPriority,
- 15 * 60, inAEIdleUPP, NULL);
- ThrowIfOSErr_(err);
- mSent = true;
-
- //if (inReplyMode == kAENoReply) delete this;
- }
-